home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 03 - 1987 / 03.11 Nov 87 / C string library / PStrLib Source / PStrLib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1987-10-21  |  1.7 KB  |  60 lines  |  [TEXT/KAHL]

  1. /*    File: PStrLib.h    */
  2.  
  3. #ifndef    _PStrLib_
  4.     #define    _PStrLib_
  5.     #ifndef _WindowMgr_
  6.         #include <WindowMgr.h>
  7.     #endif
  8.     #ifndef _FontMgr_
  9.         #include <FontMgr.h>
  10.     #endif
  11.     #ifndef _saneh_
  12.         #include <sane.h>
  13.     #endif
  14.     extern char _char[];    
  15.     #define        BOOL            1
  16.     #define        CDBL            FFEXT
  17.     #define        CSHORTDBL        FFDBL
  18.     #define        CFLOAT            FFSGL
  19.     #define        CINT            FFINT
  20.     #define        CLONG            FFLNG
  21.     #define        CCOMP            FFCOMP
  22.     #define        PSTR            2
  23.     #define        DEC                FIXEDDECIMAL
  24.     #define        SCI                FLOATDECIMAL
  25.     #define        ALL                255
  26.     #define        NIL                0L
  27.     #define        CEN                (-1)
  28.     #define        NL1                (-1)
  29.     #define        NL2                (-2)
  30.     #define        CUR                (-3)
  31.     #define        plain            ''
  32.     #define     _alpha             1
  33.     #define     _digit             2
  34.     #define     _hex            4
  35.     #define     _octal            8
  36.     #define        _ascii            16
  37.     #define        _cntrl            32
  38.     #define     _punct            64
  39.     #define     _space            128
  40. /*    The c character passed to the macros below should be
  41.     'declared as' or 'cast to' type 'Byte' or 'unsigned char'.
  42.     Type char gets sign extended to an integer. Thus, when c > 127
  43.     the _char[] subscript becomes negative!  Note that immediate
  44.     chars such as '•' do not get sign extended so they're okay.
  45. */
  46.     #define    IsAlphaNum(c)    (_char[(c)+1]&(_alpha|_digit))
  47.     #define    IsAlpha(c)        (_char[(c)+1]&_alpha)
  48.     #define    IsAscii(c)        (_char[(c)+1]&_ascii)
  49.     #define    IsCntrl(c)        (_char[(c)+1]&_cntrl)
  50.     #define IsCSym(c)        ((_char[(c)+1]&(_alpha|_digit))||(c)=='_')
  51.     #define IsCSymF(c)        ((_char[(c)+1]&_alpha)||(c)=='_')
  52.     #define IsDigit(c)        (_char[(c)+1]&_digit)
  53.     #define IsGraph(c)        ((c)>='!'&&(c)<='~')
  54.     #define    IsOctDigit(c)    (_char[(c)+1]&_octal)
  55.     #define    IsPrint(c)        ((c)>=32&&(c)<=255)
  56.     #define    IsPunct(c)        (_char[(c)+1]&_punct)
  57.     #define    IsSpace(c)        (_char[(c)+1]&_space)
  58.     #define    IsHexDigit(c)    (_char[(c)+1]&_hex)
  59. #endif
  60.